
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <title>新零售商城后台首页</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <div class="layui-input-block" style="margin: 0;padding: 0;">
                        <button class="layui-btn layuiadmin-btn-admin" data-type="j0" onclick="SelectData(0);">全部服务商</button>
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block" style="margin: 0;padding: 0;">
                        <button class="layui-btn layuiadmin-btn-admin" data-type="j2" onclick="SelectData(2);">合格服务商</button>
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block" style="margin: 0;padding: 0;">
                        <button class="layui-btn layuiadmin-btn-admin" data-type="j3" onclick="SelectData(3);">活跃服务商</button>
                    </div>
                </div>
                <div class="layui-inline">
                    <div class="layui-input-block" style="margin: 0;padding: 0;">
                        <button class="layui-btn layuiadmin-btn-admin" data-type="j4" onclick="SelectData(4);">绩优服务商</button>
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">会员ID</label>
                    <div class="layui-input-block">
                        <input type="text" name="id" id="id" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">会员编号</label>
                    <div class="layui-input-block">
                        <input type="text" name="userNo" id="userNo" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
				<div class="layui-inline">
                    <label class="layui-form-label">会员姓名</label>
                    <div class="layui-input-block">
                        <input type="text" name="userName" id="userName" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
				<div class="layui-inline">
                    <label class="layui-form-label">联系电话</label>
                    <div class="layui-input-block">
                        <input type="text" name="phone" id="phone" placeholder="请输入" autocomplete="off" class="layui-input">
                    </div>
                </div>
				<div class="layui-inline">
                    <button class="layui-btn layuiadmin-btn-admin" lay-submit lay-filter="LAY-user-back-search" onclick="SelectData(0)">
                        <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                    </button>
                </div>
            </div>
        </div>

        <div class="layui-card-body">
            <table class="layui-hide" id="test"></table>

            <script type="text/html" id="barDemo">
                <a class="layui-btn layui-btn-xs" lay-event="edit" onclick="WinOpenEdit({{d.userId}})" >编辑</a>
            </script>

        </div>
    </div>
</div>
<script src="/layui/layui.js"></script>
<script src="/layui/jquery.min.js"></script>
<script src="/js/common.js"></script>
<script>
    var table;
    layui.use('table', function(){
        table = layui.table
            ,form = layui.form;

        table.render({
            elem: '#test'
            ,url:'/user?url=Owner%2FList&rankServiceId=7'
            ,cellMinWidth: 80
            ,cols: [[
                {field:'id', title:'ID'}
                ,{field:'no', title:'编号'}
                ,{field:'nick', title:'昵称'}
                ,{field:'phone', title:'联系电话'}
                ,{field:'orderAmount', title:'微店销售'}
                ,{field:'serviceCount1', title:'合格店主'}
                ,{field:'serviceCount2', title:'活跃店主'}
                ,{field:'serviceCount3', title:'绩优店主'}
                ,{field:'rankId', title:'绩效等级',templet :function (row){return getRankName(row.rankId);}}
                ,{field:'edit', title:'查看', templet: '#barDemo', unresize: true}
            ]]
            ,page: true
            ,id: 'testReload'
        });

        //监听表格复选框选择
        table.on('checkbox(demo)', function(obj){
            console.log(obj)
        });


    });
    
    function getRankName(rankId) {
        var rankName ="";
        switch (rankId) {
            case 1:
                rankName="考核服务商";
                break;
            case 2:
                rankName="合格服务商";
                break;
            case 3:
                rankName="活跃服务商";
                break;
            case 4:
                rankName="绩优服务商";
                break;
            default :
                    break;

        }
        return rankName;
    }

    function SelectData(rankShopId) {
        //数据刷新
        var id = $('#id').val();
        var userNo = $('#userNo').val();
        var userName = $('#userName').val();
        var phone = $('#phone').val();
        var url="/user?url=Owner%2FList&rankServiceId=7";
        if(id!=null && $.trim(id)!="")
        {
            url+="&id="+id+"&";
        }
        if(userNo!=null && $.trim(userNo)!="")
        {
            url+="&no="+userNo+"&";
        }
        if(userName!=null && $.trim(userName)!="")
        {
            url+="&name="+userName+"&";
        }
        if(phone!=null && $.trim(phone)!="")
        {
            url+="&phone="+phone+"&";
        }
        if(rankShopId!=0)
        {
            url+="&rankShopId="+rankShopId+"&";
        }
        //alert(url);
        //执行重载
        table.reload('testReload', {
            url:url,
            page: {
                curr: 1 //重新从第 1 页开始
            }
        });
    }
	
	/*编辑会员*/
	function WinOpenEdit(categoryId){
		//window.parent.WinOpenEdit(this,"/user/user/edit.html?categoryId="+categoryId,"修改会员资料",330,400,1);
	}
	
</script>


</body>
</html>